define(function (require, exports, module) {
    var $ = require("jquery");
    var angular = require("angular");
    var ui = require("ui");
    require('authorize');
    require("permission");
    require("angular-route");
    require("angular-ui");
    require("angular-interceptor");
    require("plupload");
    require('../../myservice/common/nav');
    var util = require("util");
    require("./base-service");
    require("./banners-service");
    var dialog = require("dialogplus");
    require('global');

    var app = angular.module('app', ['ngRoute', 'ngUI', 'ngInterceptor', 'raiseFinanceBannersModule', 'myNav', 'raiseFinanceBaseModule']);

    app.config(['$routeProvider', function ($routeProvider) {
        $routeProvider
            .when('/list', {templateUrl: 'banners/list.html', controller: 'RaiseFinanceBannersListController'})
            .when('/edit', {templateUrl: 'banners/edit.html', controller: 'RaiseFinanceBannersEditController'})
            .otherwise({redirectTo: '/list'});
    }]);

    app.controller('RaiseFinanceBannersListController', ['$scope', '$routeParams', 'raiseFinanceBaseData', 'raiseFinanceBanners', '$q', '$http', function ($scope, $routeParams, raiseFinanceBaseData, raiseFinanceBanners, $q, $http) {
        $scope.baseData = raiseFinanceBaseData;
        $scope.bannersSvr = raiseFinanceBanners;

        var activitiesId = $routeParams.id;
        $scope.baseData.activities_id = activitiesId;

        setTimeout(function () {
            // setTimeout 为了让路由先完成，防止 dom 元素闪动
            $scope.$apply(function () {
                raiseFinanceBaseData.initData();
                raiseFinanceBanners.initData();
            });
        }, 10);

    }])

    app.controller('RaiseFinanceBannersEditController', ['$scope', '$routeParams', function ($scope, $routeParams) {

    }])

    angular.bootstrap(document, ['app']);
});